package test;

import java.awt.Button;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

public class Gui extends Frame implements ActionListener, WindowListener 
{ 
    //constructor 
    public Gui(String s) 
    { super(s); 
      setBackground(Color.yellow); 
      setLayout(new FlowLayout()); 
      addWindowListener(this);            //listen for events on this Window 
      Button pushButton = new Button("press me"); 
      add(pushButton); 
      pushButton.addActionListener(this); //listen for Button press 
    }
    //define action for Button press 
    public void actionPerformed(ActionEvent event) 
    { final char bell = '\u0007'; 
     if (event.getActionCommand().equals("press me")) 
     { System.out.print(bell);} 
    }
    //define methods in WindowListener interface 
    public void windowClosing(WindowEvent event) { System.exit(0); } 
    public void windowClosed(WindowEvent event)  {} //do nothing for now 
    public void windowDeiconified(WindowEvent event){} 
    public void windowIconified(WindowEvent event){} 
    public void windowActivated(WindowEvent event){} 
    public void windowDeactivated(WindowEvent event){} 
    public void windowOpened(WindowEvent event){} 


}
